<p-panel header="定额导入" [collapsed]="false" headerClass="bg-eaeaea border-none" headerClass="bg-eaeaea border-none"
        >
  <button pButton type="button" (click)="display = true" label="上传文件" class="btn btn-secondary"></button>
  <p-dialog header="选择文件" [(visible)]="display" modal="modal" width="550" [responsive]="true"
            (onHide)="files2 = [];fileEle.clear()">
    <p-header>
      <span class="font-12">  (注：每次只能上传一个文件，单个文件不超过100M)</span>
    </p-header>
    <div class="text-center">
      <div class="inline-block">
        <div class="table-row" *ngFor="let item of files2;index as i">
          <div class="table-cell text-left color-333 max-width-400 ellipsis-td"
               [ngClass]="isEdit?'p-required':'p-required-emp'">{{item.name}}
          </div>
          <div class="table-cell p-r-20 p-l-7">
            ({{item.size/1048576 | number:'1.0-3'}}M)
          </div>
          <div class="table-cell ">
            <span class="a-color" (click)="cancle(i);fileEle.remove($event,i)">取消</span>
          </div>
        </div>
      </div>
    </div>
    <div class="text-center">
      <p-fileUpload [multiple]="true" #fileEle styleClass="inline-block" name="file" (onSelect)="onSelect($event)"
                    [empty]="true" contentClass="p-0"
                    accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
                    chooseLabel="上传文件" [url]="url" (onUpload)="display = false;onUpload($event)"
                    (onBeforeUpload)="onBeforeUpload($event)" maxFileSize="1000000" [disabled]='files2.length>=1'>
        <ng-template let-index let-file pTemplate="file">
        </ng-template>
      </p-fileUpload>
      <button pButton type="button" [disabled]="!fileEle.hasFiles()" (click)="fileEle.upload()" label="上传"
              class="btn btn-primary v-middle m-l-40"></button>
    </div>
  </p-dialog>

  <div class="pull-right">
    <button *ngIf="isRight" pButton type="button" (click)="save()" label="保存" class="btn btn-primary"></button>
    <button type="button" label="下载模板" class="btn btn-success">
      <a href="/assets/excel/工艺.xlsx" download="工艺" class="" style="color: #fff">下载模板</a>
    </button>

  </div>
</p-panel>


<div class="showTrue ui-g-12" *ngIf="showTrue">
  <p-tabView>
    <p-tabPanel header="定额管理">
      <p-dataTable [value]="quotaList" [rows]="20" [pageLinks]="5" [showToggle]="true" [topPage]="true" [paginator]="true">
        <p-column field="category" header="类别"></p-column>
        <p-column field="quotaNum" header="定额号"></p-column>
        <p-column field="quotaName" header="定额名称"></p-column>
        <p-column field="unit" header="单位"></p-column>
        <p-column field="expirationTime" header="过期时间"></p-column>
        <p-column field="effectScope" header="区域等级"></p-column>
        <p-column field="costPrice" header="成本价"></p-column>
      </p-dataTable>
    </p-tabPanel>
    <p-tabPanel header="子项目管理">
      <p-dataTable [value]="subList" [rows]="20" [pageLinks]="5" [showToggle]="true" [topPage]="true" [paginator]="true">
        <p-column field="quotaNum" header="定额号"></p-column>
        <p-column field="subNum" header="子项目编号"></p-column>
        <p-column field="feederNum" header="工料机代号"></p-column>
        <p-column field="subName" header="工料机名称"></p-column>
        <p-column field="unit" header="单位"></p-column>
        <p-column field="amount" header="数量"></p-column>
        <p-column field="price" header="单价"></p-column>
        <p-column field="totalPrice" header="合价"></p-column>
      </p-dataTable>
    </p-tabPanel>
  </p-tabView>
</div>


<div *ngIf='showFalse'>
  <p-dataTable [value]="errorList" [showToggle]="false" [topPage]="false" [paginator]="false">
    <p-column field="bookmark" header="页签" *ngIf='errorList[0].bookmark' [style]="{'text-align':'left'}"></p-column>
    <p-column field="errLocation" header="错误位置" *ngIf='errorList[0].errLocation' [style]="{'text-align':'left'}"></p-column>
    <p-column field="reasonFailure" header="失败原因" [style]="importFlag" ></p-column>
  </p-dataTable>

</div>


